home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group02b.txt / 000046_icon-group-sender_Tue Sep 24 12:57:43 2002.msg < prev    next >
Internet Message Format  |  2003-01-02  |  4KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g8OJvRM28525
  4.     for icon-group-addresses; Tue, 24 Sep 2002 12:57:27 -0700 (MST)
  5. Message-Id: <200209241957.g8OJvRM28525@baskerville.CS.Arizona.EDU>
  6. X-Sent: 24 Sep 2002 18:26:32 GMT
  7. X-Sender: nevin@mail.hax.com
  8. Date: Tue, 24 Sep 2002 13:26:30 -0500
  9. To: icon-group@cs.arizona.edu
  10. From: "Nevin :-] Liber" <nevin@eviloverlord.com>
  11. Subject: Re: Moving from Procedural to Object-Oriented (Was Re: Icon Wish 
  12.  List)
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15.  
  16. >Andrew's post rings close to home, as my division is considering a 
  17. >move from a procedural language to an object-oriented one.
  18.  
  19. Good luck. :-)
  20.  
  21. >Accepting that on the one hand a LARGE system may benefit from the 
  22. >benefits of the object-oriented approach, while not forgetting that 
  23. >fads occur in all walks of life, including programming,
  24.  
  25. I don't think it is a fad.  It is just another tool in the toolbox.
  26.  
  27. >  I would appreciate if anyone in this group has seen the benefits vs 
  28. >the costs of moving from procedural to OO.
  29.  
  30. It is a bit too general a question.  It matters which language(s) you 
  31. are moving between.  For instance, if you are moving to C++, you get 
  32. a number of paradigms to use:  inheritance, RAII (Resource 
  33. Acquisition Is Initialisation) classes (the constructor acquires a 
  34. resource, and the destructor releases that resource; this works 
  35. because C++ destructors are called at well-defined times), generic 
  36. programming (templates), etc.  Other languages give you other 
  37. paradigms.
  38.  
  39.    Maybe also the "be sure to avoid" things.
  40.  
  41. Don't use a feature just because it is there; use it because it is 
  42. appropriate.  Not everything needs to be an object (unless your 
  43. language requires it).  Not everything needs to be a deep inheritance 
  44. tree.  Not every type of object needs to be designed for reuse. 
  45. Etc., etc.
  46.  
  47. When designing objects, try and avoid asking the object questions of 
  48. the form "what kind are you really"; this doesn't tend to scale.
  49.  
  50. Don't write new stuff procedurally just because your organisation 
  51. tends to be more comfortable doing so.
  52.  
  53. >For my part, I see the advantage of hiding data and reusing code, 
  54. >but this can be done with structured code and well-crafted libraries.
  55.  
  56. While certainly true (heck, you can do that in assembler too), the 
  57. more the language manages implicitly for the programmer, the less 
  58. buggy your software will be.  Lots of bugs in languages like C are 
  59. due to incorrect memory management (dangling pointers, memory leaks, 
  60. etc.); languages with garbage collection such as Icon never have 
  61. those kinds of problems; good discipline in C++ (using things like 
  62. Smart Pointer idioms, which is an RAII type of class) makes this much 
  63. easier than in C (not as easy as with GC, but more general, since it 
  64. can be applied to any type of resource, not just memory).  Making it 
  65. harder for programmers to express mistakes is a Good Thing.
  66.  
  67. There are, of course, development, performance and size penalties for 
  68. this, which your organisation has to use good engineering judgement 
  69. on whether the benefit is worth the cost.  And there will be a large 
  70. up front cost, as there tends to be lots of implicit undocumented 
  71. knowledge in old code bases that (hopefully) ends up being 
  72. rediscovered (and maybe even documented) in the new code base.  But 
  73. that rediscovery takes time.
  74.  
  75. OO isn't a panacea.  It is another way of doing things.  It is 
  76. another approach for expressing a design.
  77. -- 
  78.   Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (773) 961-1620
  79.